//
//  LoginViewController.m
//  Demo
//
//  Created by 龚碧容 on 2017/9/15.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "QLMLoginViewController.h"
#import "QLMRegisterUserNameVC.h"
#import "QLMRegisterViewController.h"
#import "JPUSHService.h"
#import "AppDelegate.h"
#import "QLMVeriCodeVC.h"

#import <IQKeyboardManager.h>

#define kCommonLoginFont 16.0

@interface QLMLoginViewController ()<UITextFieldDelegate>{
    BOOL isButtonSelected;
}

@property (nonatomic, strong) UITextField *phoneTextField;
@property (nonatomic, strong) UITextField *passportTextField;

@property (nonatomic, strong) UIImageView *phoneImageView;
@property (nonatomic, strong) UIImageView *passportImageView;

@property (nonatomic, strong) UIButton *loginButton;
@property (nonatomic, strong) UIButton *registerButton;

@property (nonatomic, strong) UIButton *rememberButton;
@property (nonatomic, strong) UIButton *forgetButton;

@property (nonatomic, strong) UIView *loginView;
@property (nonatomic, strong) UIImageView *loginBackView;

@property (nonatomic, strong) UIView *line1View;
@property (nonatomic, strong) UIView *line2View;
@property (nonatomic, strong) UIView *line3View;

@property (nonatomic, strong) NSLayoutConstraint *loginViewConstraint;

@end

@implementation QLMLoginViewController

- (void)loadView{
    
//    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//    self.view = scrollView;
    
    self.view = [UIView new];
    self.view.backgroundColor = [UIColor whiteColor];
    
//    [super loadView];
//    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//    scrollView.backgroundColor = [UIColor whiteColor];
//    self.view = scrollView;
    
    
    [self.view addSubview:self.loginView];
    [_loginView addSubview:self.loginBackView];
    [_loginView addSubview:self.phoneTextField];
    [_loginView addSubview:self.passportTextField];
    
    [_loginView addSubview:self.phoneImageView];
    [_loginView addSubview:self.passportImageView];
    
    [_loginView addSubview:self.loginButton];
    [_loginView addSubview:self.registerButton];
    
    [_loginView addSubview:self.rememberButton];
    [_loginView addSubview:self.forgetButton];
    
    [_loginView addSubview:self.line1View];
    [_loginView addSubview:self.line2View];
    [_loginView addSubview:self.line3View];
    
    [self.view setNeedsUpdateConstraints];
}

- (void)updateViewConstraints{

    CGFloat heightEx=44;//高度
    CGFloat topOri=10;//上边距
    CGFloat originX=20;//左右边距

    //背景视图
    [_loginView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:30];//相对于父容器顶部距离
    [_loginView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];//相对于父容器左部距离
    [_loginView autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];//相对于父容器右部距离
    [_loginView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:_registerButton withOffset:topOri];
    
    //背景图
    [self.loginBackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0];
    [self.loginBackView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:(kScreen_width-147.5)/2];//相对于父容器左部距离
    [self.loginBackView autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:(kScreen_width-147.5)/2];//相对于父容器右部距离
    [self.loginBackView autoSetDimension:ALDimensionWidth toSize:147.5];
    [self.loginBackView autoSetDimension:ALDimensionHeight toSize:148.5];//高度
    
    //账号
    [_phoneImageView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_loginBackView withOffset:30+12];
    [_phoneImageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:originX*2];//相对于父容器左部距离
    [_phoneImageView autoSetDimension:ALDimensionWidth toSize:20];//宽度
    [_phoneImageView autoSetDimension:ALDimensionHeight toSize:20];
    
    //账号输入框
    [_phoneTextField autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_loginBackView withOffset:30];
    [_phoneTextField autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:_phoneImageView withOffset:10];//左部距离
    [_phoneTextField autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:originX];//相对于父容器右部距离
    [_phoneTextField autoSetDimension:ALDimensionHeight toSize:heightEx];
    
    [_line1View autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_phoneTextField withOffset:0];
    [_line1View autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:originX];//左部距离
    [_line1View autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:originX];//相对于父容器右部距离
    [_line1View autoSetDimension:ALDimensionHeight toSize:0.5];
    
    //密码
    [_passportImageView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_phoneTextField withOffset:topOri+12 relation:NSLayoutRelationEqual];
    [_passportImageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:originX*2];//相对于父容器左部距离
    [_passportImageView autoSetDimension:ALDimensionWidth toSize:20];//宽度
    [_passportImageView autoSetDimension:ALDimensionHeight toSize:20];
    
    //密码输入框
    [_passportTextField autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_phoneTextField withOffset:topOri relation:NSLayoutRelationEqual];
    [_passportTextField autoAlignAxis:ALAxisVertical toSameAxisOfView:_phoneTextField];
    [_passportTextField autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:_passportImageView withOffset:10];//距离
    [_passportTextField autoSetDimension:ALDimensionHeight toSize:heightEx];
    
    [_line2View autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_passportTextField withOffset:0];
    [_line2View autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:originX];//左部距离
    [_line2View autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:originX];//相对于父容器右部距离
    [_line2View autoSetDimension:ALDimensionHeight toSize:0.5];
    
    //记住密码按钮
    [_rememberButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_passportTextField withOffset:2.5];
    [_rememberButton autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:originX+23];//距离
    [_rememberButton autoSetDimension:ALDimensionWidth toSize:120];
    [_rememberButton autoSetDimension:ALDimensionHeight toSize:40];
    
    //登录按钮
    [_loginButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_passportTextField withOffset:45];
    [_loginButton autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:originX];//距离
    [_loginButton autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:originX];//距离
    [_loginButton autoSetDimension:ALDimensionHeight toSize:40];
    
    //注册按钮
    [_registerButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_loginButton withOffset:17 relation:NSLayoutRelationEqual];
    //忘记密码按钮
    [_forgetButton autoAlignAxis:ALAxisHorizontal toSameAxisOfView:_registerButton];
    
    NSArray *abuttons = @[_forgetButton, _registerButton];
    [abuttons autoSetViewsDimension:ALDimensionHeight toSize:heightEx];
    [abuttons autoDistributeViewsAlongAxis:ALAxisHorizontal alignedTo:ALAttributeHorizontal withFixedSpacing:originX insetSpacing:YES matchedSizes:YES];
    
    [_line3View autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_loginButton withOffset:17+15];
    [_line3View autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:kScreen_width/2-0.5];//左部距离
    [_line3View autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kScreen_width/2];//相对于父容器右部距离
    [_line3View autoSetDimension:ALDimensionHeight toSize:heightEx-30];
    
    [super updateViewConstraints];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title=@"登录";
    [self _setupNavgationBar];
    
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:kIsRememberAccount] boolValue]) {
        isButtonSelected=YES;
        [_rememberButton setImage:[UIImage imageNamed:@"selected"] forState:UIControlStateNormal];
    }
    
    _phoneTextField.text = [[NSUserDefaults standardUserDefaults] objectForKey:kLoginPhoneName];
    _passportTextField.text =  [[NSUserDefaults standardUserDefaults] objectForKey:kLoginPassport];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateMainUI) name:@"loginUpdateMainUI" object:nil];
    
    [self.phoneTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
}

- (void)_updateMainUI{
    
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:kIsRememberAccount] boolValue]) {
        return;
    }
    _phoneTextField.text=@"";
    _passportTextField.text=@"";
    _phoneTextField.placeholder=@"请输入手机号";
    _passportTextField.placeholder=@"请输入密码";
}

- (void)_setupNavgationBar{
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(20, 0, 44, 44);
    [leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [leftButton setBackgroundColor:[UIColor clearColor]];
    leftButton.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
    [leftButton addTarget:self action:@selector(leftClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc]
                                   initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                   target:nil
                                   action:nil];
    fixedSpace.width = 0;
    
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:fixedSpace,leftItem,nil];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden=NO;
    self.navigationController.navigationBar.translucent=NO;
    
    [IQKeyboardManager sharedManager].enable = NO;
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.view endEditing:YES];
    [IQKeyboardManager sharedManager].enable = YES;
    [self _updateMainUI];
}

- (void)leftClick{
    [self.view endEditing:YES];
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];

    AppDelegate *appdele=(AppDelegate *)[UIApplication sharedApplication].delegate;
    appdele.tabbarController.selectedIndex=0;
}

- (void)_dismissPushVC:(NSString *)currentuid{
    if(![self.pushUid isEqualToString:currentuid]){
        [self dismissViewControllerAnimated:YES completion:nil];
    }else{
        [self dismissViewControllerAnimated:YES completion:^{
            AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate;
            [app pushToLoginerUidCorret];
        }];
    }
}

#pragma mark - UITextField Delegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

- (void)textFieldDidChange:(UITextField *)textField{
    if (textField == _phoneTextField) {
        if (textField.text.length > 11) {
            UITextRange *markedRange = [textField markedTextRange];
            if (markedRange) {
                return;
            }
            NSRange range = [textField.text rangeOfComposedCharacterSequenceAtIndex:11];
            textField.text = [textField.text substringToIndex:range.location];
        }
    }
}

-(void)textFieldDidBeginEditing:(UITextField *)textField{
    
    float offset = 0.0f;
    
    if (kScreen_height==480) {
        if(textField == _passportTextField){
            offset = -80;
        }else if (textField == _phoneTextField){
            offset = -40;
        }
    }else{
        if(textField == _passportTextField){
            offset = -30;
        }
    }
    NSTimeInterval animationDuration = 0.30f;
    
    [UIView beginAnimations:@"ResizeForKeyBoard" context:nil];
    [UIView setAnimationDuration:animationDuration];
    
    float width = self.view.frame.size.width;
    float height = self.view.frame.size.height;
    
    CGRect rect = CGRectMake(0.0f, offset , width, height);
    self.view.frame = rect;
    [UIView commitAnimations];
}

-(void)textFieldDidEndEditing:(UITextField *)textField{
    
    float offset = QLM_StatusBarAndNavigationBarHeight;
    NSTimeInterval animationDuration = 0.30f;
    
    [UIView beginAnimations:@"ResizeForKeyBoard" context:nil];
    [UIView setAnimationDuration:animationDuration];
    
    float width = self.view.frame.size.width;
    float height = self.view.frame.size.height;
    
    CGRect rect = CGRectMake(0.0f, offset , width, height);
    self.view.frame = rect;
    [UIView commitAnimations];
}

- (BOOL)textFieldShouldClear:(UITextField *)textField{
    return YES;
}

#pragma mark - 登录 退出 注册 忘记密码
- (void)loginAction:(UIButton *)sender{
    sender.enabled=NO;
    [_phoneTextField resignFirstResponder];
    [_passportTextField resignFirstResponder];
    
    if (_phoneTextField.text.length==0) {
        ETToast(@"请输入手机号码！");
        sender.enabled=YES;
        return;
    }
    if (![ClientTool isMobileValid:_phoneTextField.text]) {
        ETToast(@"请输入正确的手机号码！");
        sender.enabled=YES;
        return;
    }
    if (_passportTextField.text.length==0) {
        ETToast(@"请输入密码！");
        sender.enabled=YES;
        return;
    }
    sender.enabled=YES;
    [self requestNetData]; //请求网络数据
}

- (void)registerButtonAction:(UIButton *)sender{
    [self pushToCommonVC:@"注册"];
}

- (void)rememberButtonAction:(UIButton *)sender{
    if (isButtonSelected) {
        isButtonSelected=NO;
        [sender setImage:[UIImage imageNamed:@"unselected"] forState:UIControlStateNormal];
    }else{
        isButtonSelected=YES;
        [sender setImage:[UIImage imageNamed:@"selected"] forState:UIControlStateNormal];
    }
}

- (void)forgetButtonAction:(UIButton *)sender{
    QLMRegisterViewController *registerVC=[QLMRegisterViewController new];
    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:registerVC animated:YES];
}

- (void)pushToCommonVC:(NSString *)titleString{
    QLMRegistViewController *registerVC=[QLMRegistViewController new];
    self.hidesBottomBarWhenPushed=YES;
    registerVC.titleStr=titleString;
    [self.navigationController pushViewController:registerVC animated:YES];
}

#pragma mark - 请求数据 保存数据
- (void)requestNetData{
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    [dic setObject:_phoneTextField.text forKey:@"phoneNumber"];
    [dic setObject:[ClientTool md5:_passportTextField.text] forKey:@"password"];
    
    [self.view makeToastActivity:CSToastPositionCenter];
    [ClientTool postUrlPath:@"/auth/login" withParamers:dic andBody:nil
                   success:^(id responseObject){
                       [self.view hideToastActivity];
                       NSInteger code = [[responseObject objectForKey:@"flag"] integerValue];
                       if (code == 1) {
                           _resultBlock(YES);
                           
                           NSString *userid= [[responseObject[@"data"] objectForKey:@"user"] objectForKey:@"userId"];
                           NSString *userName=[[responseObject[@"data"] objectForKey:@"user"] objectForKey:@"userName"];
                           
                           [[NSUserDefaults standardUserDefaults] setObject:userid forKey:kLoginUserId];
                           [[NSUserDefaults standardUserDefaults] setObject:userName forKey:kLoginUserName];
                         
                           [[NSUserDefaults standardUserDefaults] setObject:@(isButtonSelected) forKey:kIsRememberAccount];
                           
                           [self saveUserInfo:responseObject[@"token"]];

                           NSString *auserId = [NSString stringWithFormat:@"%@",userid];
                           [JPUSHService setAlias:auserId completion:^(NSInteger iResCode, NSString *iAlias, NSInteger seq) {
                           } seq:0];
                           
                           if ([ClientTool isNull:_pushUid]) {
                               [self _dismissPushVC:auserId];
                           }else{
                               [self leftClick];
                           }
                           
                       }else if (code==2){
                           QLMVeriCodeVC *registerUserNameVC=[QLMVeriCodeVC new];
                           registerUserNameVC.phoneNumber=_phoneTextField.text;
                           registerUserNameVC.passportStr=_passportTextField.text;
                           self.hidesBottomBarWhenPushed=YES;
                           [self.navigationController pushViewController:registerUserNameVC animated:YES];
                       }else{
                           ETToast(responseObject[@"msg"]);
                       }
                   }failure:^(NSError *error){
                       [self.view hideToastActivity];
                       ETToast(@"服务器连接失败");
                   }
     ];
}

- (void)saveUserInfo:(NSString *)token{
    [[NSUserDefaults standardUserDefaults] setObject:_phoneTextField.text forKey:kLoginPhoneName];
    [[NSUserDefaults standardUserDefaults] setObject:_passportTextField.text forKey:kLoginPassport];
    [[NSUserDefaults standardUserDefaults] setObject:token forKey:kLoginToken];
}

#pragma mark - 创建UI
- (UIView *)loginView{

    if (!_loginView) {
        _loginView=[UIView newAutoLayoutView];
        _loginView.backgroundColor=[UIColor clearColor];
        _loginView.layer.masksToBounds=YES;
        _loginView.layer.cornerRadius=5.0;
    }
    
    return _loginView;
}

- (UIImageView *)phoneImageView{

    if (!_phoneImageView){
        _phoneImageView = [UIImageView newAutoLayoutView];
        _phoneImageView.image=[UIImage imageNamed:@"phone"];
    }
    return _phoneImageView;
}


- (UIImageView *)passportImageView{

    if (!_passportImageView) {
        _passportImageView = [UIImageView newAutoLayoutView];
        _passportImageView.image = [UIImage imageNamed:@"password"];
    }
    return _passportImageView;
}

- (UITextField *)phoneTextField{
    
    if (!_phoneTextField) {
        _phoneTextField=[UITextField newAutoLayoutView];
        _phoneTextField.placeholder=@"请输入手机号";
        _phoneTextField.delegate=self;
        _phoneTextField.font=[UIFont systemFontOfSize:kCommonLoginFont];
        _phoneTextField.backgroundColor=[UIColor whiteColor];
        _phoneTextField.keyboardType=UIKeyboardTypeNumberPad;
        _phoneTextField.clearButtonMode=UITextFieldViewModeWhileEditing;
    }
    return _phoneTextField;
}

- (UITextField *)passportTextField{
    
    if (!_passportTextField) {
        _passportTextField=[UITextField newAutoLayoutView];
        _passportTextField.placeholder=@"请输入密码";
        _passportTextField.delegate=self;
        _passportTextField.font=[UIFont systemFontOfSize:kCommonLoginFont];
        _passportTextField.backgroundColor=[UIColor whiteColor];
        _passportTextField.keyboardType=UIKeyboardTypeEmailAddress;
        _passportTextField.clearButtonMode=UITextFieldViewModeWhileEditing;
        _passportTextField.secureTextEntry=YES;
    }
    return _passportTextField;
}

- (UIButton *)loginButton{
    if (!_loginButton) {
        _loginButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [_loginButton setTitle:@"登录" forState:UIControlStateNormal];
        _loginButton.backgroundColor=kButtonColor;
        [_loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _loginButton.titleLabel.font=[UIFont systemFontOfSize:18];
        [_loginButton addTarget:self action:@selector(loginAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _loginButton;
}

- (UIButton *)registerButton{
    if (!_registerButton) {
        _registerButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [_registerButton setTitle:@"用户注册" forState:UIControlStateNormal];
        _registerButton.backgroundColor=[UIColor clearColor];
        _registerButton.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
        [_registerButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        _registerButton.titleLabel.font=[UIFont systemFontOfSize:16];
        [_registerButton addTarget:self action:@selector(registerButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _registerButton;
}

- (UIButton *)rememberButton{
    if (!_rememberButton) {
        _rememberButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [_rememberButton setTitle:@"记住密码" forState:UIControlStateNormal];
        [_rememberButton setImage:[UIImage imageNamed:@"unselected"] forState:UIControlStateNormal];
        _rememberButton.backgroundColor=[UIColor clearColor];
        _rememberButton.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
        [_rememberButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        _rememberButton.titleLabel.font=[UIFont systemFontOfSize:16];
        _rememberButton.titleEdgeInsets=UIEdgeInsetsMake(0, 10, 0, 0);
        [_rememberButton addTarget:self action:@selector(rememberButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _rememberButton;
}

- (UIButton *)forgetButton{
    
    if (!_forgetButton) {
        _forgetButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [_forgetButton setTitle:@"忘记密码" forState:UIControlStateNormal];
        _forgetButton.backgroundColor=[UIColor clearColor];
        _forgetButton.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
        [_forgetButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        _forgetButton.titleLabel.font=[UIFont systemFontOfSize:kCommonLoginFont];
        [_forgetButton addTarget:self action:@selector(forgetButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _forgetButton;
}

- (UIImageView *)loginBackView{
    
    if (!_loginBackView) {
        _loginBackView=[UIImageView newAutoLayoutView];
        _loginBackView.backgroundColor=[UIColor clearColor];
        _loginBackView.image=[UIImage imageNamed:@"LOGO"];
    }
    
    return _loginBackView;
}

- (UIView *)line1View{
    if (!_line1View) {
        _line1View=[UIView newAutoLayoutView];
        _line1View.backgroundColor=[UIColor lightGrayColor];
    }
    return _line1View;
}

- (UIView *)line2View{
    if (!_line2View) {
        _line2View=[UIView newAutoLayoutView];
        _line2View.backgroundColor=[UIColor lightGrayColor];
    }
    return _line2View;
}

- (UIView *)line3View{
    if (!_line3View) {
        _line3View=[UIView newAutoLayoutView];
        _line3View.backgroundColor=[UIColor lightGrayColor];
    }
    return _line3View;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
